package cn.kgc.spring05;

import cn.kgc.spring05.mapper.UserMapper;
import cn.kgc.spring05.service.UserService;
import cn.kgc.spring05.servlet.UserServlet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author: mosin
 * @version: v1.0  2022/12/2
 * 测试spring的测试模块
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring-config.xml")  // 声明配置文件的位置
public class SpringTestUserServlet {

    @Autowired
    private UserServlet userServlet;

    @Autowired
    private UserService userService;

    @Autowired
    private UserMapper userMapperImpl;

    @Test
    public void test01(){
        boolean b = userServlet.deleteById(10);
        System.out.println("b = " + b);
    }

    @Test
    public void test02(){

        Boolean aBoolean = userService.deleteById(30);
        System.out.println("aBoolean = " + aBoolean);
    }

    @Test
    public void test03(){

        Integer integer = userMapperImpl.deleteById(10);
        System.out.println("integer = " + integer);
    }
}
